{% extends '::base.html.twig' %}

{% block title %}Survey{% endblock %}
{% block body %}{%block content %}
    <h1>Ankieta</h1>
    
    <table class="record_properties">
        <tbody>
            <tr>
                <th>Id</th>
                <td>{{ entity.id }}</td>
            </tr>
            <tr>
                <th>Name</th>
                <td>{{ entity.name }}</td>
            </tr>
            <tr>
                <th>Decoded pairs</th>
                <td>{{ decoded_pairs|length }} porównań:<br />
                    {% for pair in decoded_pairs %}
                        {{pair[0]+1}} ({{entity.products[pair[0]].name}}) 
                        vs 
                        ({{entity.products[pair[1]].name}}) {{pair[1]+1}} <br />
                    {%endfor%}
                </td>
            </tr>
            <tr>
                <th>Createdat</th>
                <td>{{ entity.createdAt|date('Y-m-d H:i:s') }}</td>
            </tr>
            <tr>
                <th>Updatedat</th>
                <td>{{ entity.updatedAt|date('Y-m-d H:i:s') }}</td>
            </tr>
            <tr>
                <th>Wypełnionych ankiet</th>
                <td>{{entity.results|length}}</td>
            </tr>
            <tr>
                <th>Overall Results</th>
                <td>
                    {% set i=1 %}
                    {% for product in overallResultArray %}
                        {{i}}.  <img src="{{product.image}} " width="100" /><b>{{product.produkt}}</b> Wynik: {{product.wartosc|round(4,'floor')}} 
                       
                        {% set i=i+1 %}
                        <br />
                    {% endfor %}
                </td>
            </tr>
        </tbody>
    </table>

        <ul class="record_actions">
    <li>
        <a href="{{ path('survey') }}">
            Back to the list
        </a>
    </li>
    <li>
        <a href="{{ path('survey_edit', { 'id': entity.id }) }}">
            Edit
        </a>
    </li>
    <li>{{ form(delete_form) }}</li>
</ul>
    {% endblock %}

{% endblock %}
